package shiqi.controller;

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;
import shiqi.pojo.User;

//restful风格的控制器
@RestController
//自动配置
//@EnableAutoConfiguration(exclude = {DataSourceAutoConfiguration.class})
public class HelloController {
    @RequestMapping("hello")
    public String hello() {
        return "hello springBoot";
    }
    @RequestMapping("helloMan/{name}")
    public String helloMan(@PathVariable String name) {
        return name + "hello";
    }

    @RequestMapping("helloUser/{id}")
    @ResponseBody
    public User helloUser(@PathVariable("id") Integer is) {
        User user = new User();
        user.setId(is);
        user.setUsername("shiqi");
        user.setPassword("123456");
        return user;
    }


    /*public static void main(String[] args) {
        SpringApplication.run(HelloController.class,args);
    }*/
}
